import request from './request'

const baseURL = import.meta.env.VITE_API_URL
export const postsAPI = {
  getPostById(postId) {
    return request.get(baseURL + `/posts/${postId}`)
  },

  getPostPaginated(cursor = null, pageSize = 10, my_posts  = false) {
    return request.get(baseURL + `/posts/getPostPaginated`, {
      params: {
        cursor,
        page_size: pageSize,
        my_posts
      }
    })
  },

  createPost(data) {
    return request.post(baseURL + '/posts', {
      title: data.title,
      content:  data.content,
      status: "published"
    })
  },

  deletePost(postId) {
    return request.delete(baseURL + `/posts/${postId}`)
  }
}